﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin.master" AutoEventWireup="true" CodeFile="VayNganHang.aspx.cs" Inherits="VayNganHang" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <asp:UpdatePanel ID="up1" runat="server">
        <ContentTemplate>
            <div class="panel panel-success margin">
                <div class="panel-heading">
                    <h3 class="panel-title">
                        Quản lý vay ngân hàng</h3>
                </div>
                <div class="panel-body">
                    <table width="100%">
                        <tr>
                            <td width="10%">
                                Ngày tháng<br />
                                <asp:TextBox runat="server" CssClass="form-control " ID="txtngaythang">
                                </asp:TextBox>
                                <cc1:CalendarExtender PopupPosition="BottomRight" ID="CalendarExtender2" runat="server"
                                    TargetControlID="txtngaythang" Format="dd/MM/yyyy">
                                </cc1:CalendarExtender>
                                <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender3" runat="server" FilterType="Custom,Numbers"
                                    TargetControlID="txtngaythang" ValidChars="/" />
                            </td>
                            <td width="10%">
                                Họ tên người cho vay<br />
                                <asp:DropDownList runat="server" CssClass="form-control " ID="drnguoichovay" DataTextField="tenncc"
                                    DataValueField="IDs">
                                </asp:DropDownList>
                            </td>
                            <td width="10%">
                                Bên vay<br />
                                <asp:DropDownList runat="server" CssClass="form-control " ID="drbenvay" DataTextField="hoten"
                                    DataValueField="IDs">
                                </asp:DropDownList>
                            </td>
                            <td width="10%">
                                Đơn vị<br />
                                <asp:TextBox runat="server" CssClass="form-control " ID="txtdonvi">
                                </asp:TextBox>
                            </td>
                            <td width="10%">
                                Số tiền<br />
                                <asp:TextBox ID="txtsotien" CssClass="form-control " runat="server"></asp:TextBox>
                                <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender1" runat="server" FilterType="Custom,Numbers"
                                    TargetControlID="txtsotien" ValidChars=",." />
                            </td>
                             <td width="10%">
                                Thời hạn vay<br />
                                <asp:TextBox ID="txtthoihanvay" CssClass="form-control " runat="server"></asp:TextBox>
                                
                            </td>
                            <td width="10%">
                                Kỳ hạn vay<br />
                                <asp:DropDownList runat="server" CssClass="form-control " ID="drkyhan" DataTextField="kyhan"
                                    DataValueField="IDs">
                                </asp:DropDownList>
                            </td>
                             <td width="10%">
                                Kì trả lãi<br />
                                <asp:TextBox ID="txtkitralai" CssClass="form-control " runat="server"></asp:TextBox>
                                
                            </td>
                            <td width="10%">
                                Kì trả gốc<br />
                                <asp:TextBox ID="txtkitragoc" CssClass="form-control " runat="server"></asp:TextBox>
                                
                            </td>
                        </tr>
                        <tr>
                            <td colspan="3" valign="top">
                                <asp:GridView ID="GV1" Visible="true" AutoGenerateColumns="false" runat="server"
                                    BackColor="White" Font-Size="14px" Width="98%" BorderColor="#CCCCCC" EmptyDataText="Không có dữ liệu nào"
                                    BorderStyle="None" BorderWidth="1px" CellPadding="3" EnableModelValidation="True"
                                    OnRowDeleting="gv_RowDeleting">
                                    <Columns>
                                        <asp:BoundField DataField="RowNumber" HeaderText="STT" HeaderStyle-Width="50px" HeaderStyle-HorizontalAlign="Center"
                                            ItemStyle-HorizontalAlign="Center"></asp:BoundField>
                                        <asp:TemplateField HeaderText="% Lãi" ItemStyle-HorizontalAlign="Center">
                                            <ItemTemplate>
                                                <asp:TextBox ID="txtphantramlai" runat="server" Width="98%"></asp:TextBox>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Từ ngày" ItemStyle-HorizontalAlign="Center">
                                            <ItemTemplate>
                                                <asp:TextBox runat="server" CssClass="form-control with98" ID="tungay">
                                                </asp:TextBox>
                                                <cc1:CalendarExtender PopupPosition="BottomRight" ID="CalendarExtender1" runat="server"
                                                    TargetControlID="tungay" Format="dd/MM/yyyy">
                                                </cc1:CalendarExtender>
                                                <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender2" runat="server" FilterType="Custom,Numbers"
                                                    TargetControlID="tungay" ValidChars="/" />
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="Đến ngày" ItemStyle-HorizontalAlign="Center">
                                            <ItemTemplate>
                                                <asp:TextBox runat="server" CssClass="form-control with98" ID="denngay">
                                                </asp:TextBox>
                                                <cc1:CalendarExtender PopupPosition="BottomRight" ID="CalendarExtender3" runat="server"
                                                    TargetControlID="denngay" Format="dd/MM/yyyy">
                                                </cc1:CalendarExtender>
                                                <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender4" runat="server" FilterType="Custom,Numbers"
                                                    TargetControlID="denngay" ValidChars="/" />
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:CommandField HeaderText="Xóa" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="45px"
                                            ShowDeleteButton="True" DeleteText="Xóa" />
                                    </Columns>
                                    <FooterStyle BackColor="#6EA1C0" ForeColor="#000066" />
                                    <HeaderStyle BackColor="#6EA1C0" Font-Bold="True" ForeColor="White" Height="40px"
                                        HorizontalAlign="Center" VerticalAlign="Middle" />
                                    <PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" />
                                    <RowStyle ForeColor="#000066" Height="30px" />
                                    <SelectedRowStyle BackColor="#F1F1F1" Font-Bold="True" />
                                </asp:GridView>
                            </td>
                      
                            
                        <td colspan="3" valign="top">
                                <asp:GridView ID="GridView1" Visible="true" AutoGenerateColumns="false" runat="server"
                                    BackColor="White" Font-Size="14px" Width="98%" BorderColor="#CCCCCC" EmptyDataText="Không có dữ liệu nào"
                                    BorderStyle="None" BorderWidth="1px" CellPadding="3" EnableModelValidation="True"
                                    OnRowDeleting="gv_RowDeleting1">
                                    <Columns>
                                        <asp:BoundField DataField="RowNumber" HeaderText="STT" HeaderStyle-Width="50px" HeaderStyle-HorizontalAlign="Center"
                                            ItemStyle-HorizontalAlign="Center"></asp:BoundField>
                                        <asp:TemplateField HeaderText="Nội dung" ItemStyle-HorizontalAlign="Center">
                                            <ItemTemplate>
                                                <asp:TextBox ID="txtnoidung" runat="server" CssClass="form-control with98"></asp:TextBox>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:CommandField HeaderText="Xóa" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="45px"
                                            ShowDeleteButton="True" DeleteText="Xóa" />
                                    </Columns>
                                    <FooterStyle BackColor="#6EA1C0" ForeColor="#000066" />
                                    <HeaderStyle BackColor="#6EA1C0" Font-Bold="True" ForeColor="White" Height="40px"
                                        HorizontalAlign="Center" VerticalAlign="Middle" />
                                    <PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" />
                                    <RowStyle ForeColor="#000066" Height="30px" />
                                    <SelectedRowStyle BackColor="#F1F1F1" Font-Bold="True" />
                                </asp:GridView>
                            </td>

                       <td colspan="3" valign="top">
                                <asp:GridView ID="GridView2" Visible="true" AutoGenerateColumns="false" runat="server"
                                    BackColor="White" Font-Size="14px" Width="98%" BorderColor="#CCCCCC" EmptyDataText="Không có dữ liệu nào"
                                    BorderStyle="None" BorderWidth="1px" CellPadding="3" EnableModelValidation="True"
                                    OnRowDeleting="gv_RowDeleting2">
                                    <Columns>
                                        <asp:BoundField DataField="RowNumber" HeaderText="STT" HeaderStyle-Width="50px" HeaderStyle-HorizontalAlign="Center"
                                            ItemStyle-HorizontalAlign="Center"></asp:BoundField>
                                        <asp:TemplateField HeaderText="Tài sản thế chấp" ItemStyle-HorizontalAlign="Center">
                                            <ItemTemplate>
                                                <asp:TextBox ID="txttaisanthechap" runat="server" CssClass="form-control with98"></asp:TextBox>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:CommandField HeaderText="Xóa" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="45px"
                                            ShowDeleteButton="True" DeleteText="Xóa" />
                                    </Columns>
                                    <FooterStyle BackColor="#6EA1C0" ForeColor="#000066" />
                                    <HeaderStyle BackColor="#6EA1C0" Font-Bold="True" ForeColor="White" Height="40px"
                                        HorizontalAlign="Center" VerticalAlign="Middle" />
                                    <PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" />
                                    <RowStyle ForeColor="#000066" Height="30px" />
                                    <SelectedRowStyle BackColor="#F1F1F1" Font-Bold="True" />
                                </asp:GridView>
                            </td></tr>
                            <tr>
                              <td colspan="3">
                                <asp:Button ID="btnAdd" ValidationGroup="add" runat="server" Text="Thêm nội dung lãi"
                                    CssClass="btn btn-info" OnClick="btnAdd_Click" />
                            </td>
                             <td colspan="3">
                                <asp:Button ID="Button1" ValidationGroup="add" runat="server" Text="Thêm nội dung"
                                    CssClass="btn btn-info" onclick="Button1_Click" />
                            </td>
                            <td colspan="3">
                                <asp:Button ID="Button2" ValidationGroup="add" runat="server" Text="Thêm tài sản"
                                    CssClass="btn btn-info" onclick="Button2_Click" />
                            </td>
                          
                           
                        </tr>
                        <tr>
                            <td colspan="6">
                                <asp:Button ID="btnSave" ValidationGroup="Them" runat="server" Style="margin-left: 5px;"
                                    Text="Lưu lại" CssClass="btn btn-primary" OnClick="btnSave_Click" />
                                <asp:Button ID="btncapnhat" runat="server" Text="Cập nhật" CssClass="btn btn-info"
                                    Visible="false" OnClick="btncapnhat_Click" />
                                <asp:Button ID="btnCancel" runat="server" Text="Nhập mới" CssClass="btn btn-warning"
                                    OnClick="btnCancel_Click" />
                                <asp:Button ID="btnTraTienLai" runat="server" Text="Trả tiền lãi" CssClass="btn btn-info"
                                    Visible="false" />
                                <asp:Button ID="btnTraTienGoc" Visible="false" runat="server" Style="margin-left: 5px;"
                                    Text="Trả tiền gốc" CssClass="btn btn-primary" />
                            </td>
                        </tr>
                        
                    </table>
                    <asp:ValidationSummary ID="ValidationSummary1" HeaderText="Bạn phải nhập các trường sau:"
                        ShowMessageBox="true" ValidationGroup="Them" ShowSummary="false" EnableClientScript="true"
                        runat="server" />
                </div>
            </div>
            <div style="margin: 5px;">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        Danh sách vay tiền mặt</div>
                    <div style="margin-bottom: 5px;">
                    </div>
                    <div style="width: 100%; margin-top: 10px; overflow: auto;" class="wrapper">
                        <div style="width: 100%; max-height: 300px;">
                            <asp:GridView ID="GV" runat="server" AutoGenerateColumns="false" BackColor="White"
                                BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="1" EmptyDataText="Không có dữ liệu nào"
                                EnableModelValidation="True" ShowFooter="false" CssClass="form-control withall"
                                Width="99%" OnRowCommand="GV_RowCommand" onprerender="GV_PreRender">
                                <Columns>
                                    <asp:TemplateField HeaderText="Xóa" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="50px"
                                        ItemStyle-Width="50px">
                                        <ItemTemplate>
                                            <asp:ImageButton ID="lbXoa" runat="server" Width="20px" Height="20px" ImageUrl="~/img/delete-24.png"
                                                OnClientClick="return confirm('Bạn chắc chắn muốn xóa ?')" CommandArgument='<%#Eval("IDs")%>'
                                                Text="Xóa" CommandName="Del" />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Sửa" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="50px"
                                        ItemStyle-Width="50px">
                                        <ItemTemplate>
                                            <asp:ImageButton ID="lbSua" runat="server" Width="15px" Height="15px" ImageUrl="~/img/edit.ico"
                                                CommandArgument='<%#Eval("IDs")%>' Text="Sửa" CommandName="Select" />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                  
                                    <asp:BoundField DataField="ngaythang" ItemStyle-CssClass="padding" HeaderText="Ngày tháng"
                                        HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" />
                                    <asp:BoundField DataField="tenncc" ItemStyle-CssClass="padding" HeaderText="Ngân hàng"
                                        HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" />
                                    <asp:BoundField DataField="sotien" ItemStyle-CssClass="padding" HeaderText="Số tiền"
                                        HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Right" />
                                    <asp:BoundField DataField="thoihanvay" ItemStyle-CssClass="padding" HeaderText="Thời hạn vay"
                                        HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Right" />
                                     <asp:BoundField DataField="kitralai" ItemStyle-CssClass="padding" HeaderText="Kì trả lãi"
                                        HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Right" />
                                    <asp:BoundField DataField="kitragoc" ItemStyle-CssClass="padding" HeaderText="Kì trả gốc"
                                        HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Right" />
                                         <asp:BoundField DataField="phantramlai" ItemStyle-CssClass="padding" HeaderText="Phần trăm lãi"
                                        HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Right" />
                                         <asp:BoundField DataField="tungay" ItemStyle-CssClass="padding" HeaderText="Từ ngày"
                                        HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" />
                                        <asp:BoundField DataField="denngay" ItemStyle-CssClass="padding" HeaderText="Đến ngày"
                                        HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" />
                                </Columns>
                                <FooterStyle BackColor="White" ForeColor="#000066" Font-Bold="True" HorizontalAlign="Left" />
                                <HeaderStyle BackColor="White" Font-Bold="True" ForeColor="Black" Height="30px" />
                                <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
                                <RowStyle BackColor="White" ForeColor="#000066" Height="30px" />
                                <SelectedRowStyle BackColor="Lavender" Font-Bold="false" />
                            </asp:GridView>
                        </div>
                    </div>
                </div>
                <asp:HiddenField ID="hdID" runat="server" />
                <asp:HiddenField ID="HiddenField1" runat="server" />
            </div>
    
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>

